<template>
    <view class="page-wallet-index">
        <view class="balance">
            账户余额
            <view class="money"><text class="value font-bold">{{ wallet.balance }}</text></view>
        </view>
        <!-- <view class="desc">
            <view>1、新人入会，满足30天不退费、不转会，则给城市会长结算运营费（会员费的25%）、城市分会长结算运营费（会员费的25%）； </view>
            <view>2、新人入会，满足30天不退费、但转到原本城市的其他分会，则给城市会长结算运营费（会员费的25%）、城市分会长不结算运营费；</view>
            <view>3、新人入会，满足30天不退费、但是转到其他城市的分会，则不结算运营费</view>
        </view> -->
        <u-grid :col="3" class="statistics">
            <u-grid-item>
                <view class="font-bold">{{ wallet.amount }}</view>
                <view class="grid-text">累计总收入</view>
            </u-grid-item>
            <u-grid-item>
                <view class="font-bold">{{ wallet.waitAmount }}</view>
                <view class="grid-text">待入账金额</view>
            </u-grid-item>
            <u-grid-item>
                <view class="font-bold">{{ wallet.withdrawAmount }}</view>
                <view class="grid-text">已提现金额</view>
            </u-grid-item>            
            <u-grid-item>
                <view class="font-bold">{{ wallet.cityAmount }}</view>
                <view class="grid-text">城市运营收入</view>
            </u-grid-item>
            <u-grid-item>
                <view class="font-bold">{{ wallet.branchAmount }}</view>
                <view class="grid-text">分会运营收入</view>
            </u-grid-item>
            <u-grid-item>
                <view class="font-bold">{{ wallet.referrerAmount }}</view>
                <view class="grid-text">拉新收入</view>
            </u-grid-item>
        </u-grid>
        <view class="mt-2">
            <u-cell-group :border="false">
                <u-cell-item v-for="(item,index) in menu" :key="index" :title="item.title"  @click="proxy.$util.gotoPage(item.url)"/>
            </u-cell-group>
        </view>
        <view class="m-[40rpx]">
                <u-button class="btn-cyan-gradient" shape="circle" @click="proxy.$util.gotoPage('/packageA/wallet/withdraw')" > 申请提现 </u-button>
        </view>
    </view>
</template>
<script setup lang="ts">
import { onShow,onShareAppMessage } from '@dcloudio/uni-app';
import { useAppStore } from '@/stores/app';
let appStore = useAppStore();
const {proxy} = getCurrentInstance() as ComponentInternalInstance;
let userInfo = ref();
let wallet = ref();
let menu = reactive([
    // {title:'去提现', icon: proxy.$icon.contactbranchpresident, url: '/packageA/wallet/withdraw'},
    {title:'预收入明细', icon: proxy.$icon.mymember, url: '/packageA/wallet/preIncome'},
    {title:'收入明细', icon: proxy.$icon.mymember, url: '/packageA/wallet/incomeRecords'},
    {title:'提现记录', icon: proxy.$icon.establishbranch, url: '/packageA/wallet/withdrawRecords'},
]);
const getWallet = () => {
    proxy.$http('get', '/admin/appuser/user/wallet', {}, (data,msg) => {
        wallet.value = data;
    })
}
onShow(() => {
    userInfo.value = appStore.userInfo; 
    getWallet();
})
</script>